<?php
namespace app\common\model;
use think\Model;

class Message extends Base
{
   protected $autoCheckFields = true;

//发送消息
/**
 * [send 消息发送]
 * @param  [type] $to_uid      [接收用户uid]
 * @param  [type] $title       [消息标题]
 * @param  [type] $msg_content [消息内容]
 * @param  string $type        [0 通知 1 私信]
 * @return [type]              [true|false]
 */
   public function send($to_uid,$title,$msg_content,$type="0"){
      $data['title']   = $title;            
      $data['content'] = $msg_content;
      $data['to_uid']  = $to_uid;
      $data['type']    = $type;
      $data['create_time'] = time();
      $res = model('message')->addData($data);
      if(!empty($res)){
         return true;
      }else{
      	 return false;
      }
   }








 //通过ID获得信息
   public function getMessageById($id){
   	 $where['id'] = $id;
     return $this->where($where)->find();
    }

}
